#ifndef __BUTTON_H_
#define __BUTTON_H_

//将SDL函数和数据类型包含进来
#include "SDL/SDL.h"
#include <string>
#include <iostream>
#include "SDL/SDL_mixer.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_image.h"

using namespace std;

#define CLIP_MOUSEOVER 0
#define CLIP_MOUSEOUT 1
#define CLIP_MOUSEDOWN 2
#define CLIP_MOUSEUP 3

//按钮类
class Button
{
private:
    //按钮的属性
    SDL_Rect box;
    //按键状态
    SDL_Surface *buttonOut;
    SDL_Surface *buttonOver;
    SDL_Surface *buttonDown;
    SDL_Surface *buttonUp;
    SDL_Surface **buttonNowStatus;

public:
    //初始化变量
    Button( int x, int y, int w, int h );
    //处理事件并设置按钮的精灵图子图
    void handle_events(SDL_Event event);
    //将按钮显示在窗口中
    void show(SDL_Surface* screen);
    void setOutImage(SDL_Surface *buttonOut);
    void setOverImage(SDL_Surface *buttonOver);
    void setDownImage(SDL_Surface *buttonDown);
    void setUpImage(SDL_Surface *buttonUp);
    void setClips();
};

#endif //__BUTTON_H_